package com.zhuozhou.jdyc.bean.base;

/**
 * Created by huanghaibin
 * on 16-5-23.
 */
public class ResultBean<T> {
    public static final int RESULT_SUCCESS = 1;
    public static final int RESULT_UNKNOW = 0;
    public static final int RESULT_ERROR = 204;
    public static final int RESULT_NOT_FIND = 404;
    public static final int RESULT_NOT_LOGIN = 201;
    public static final int RESULT_TOKEN_EXPRIED = 202;
    public static final int RESULT_NOT_PERMISSION = 203;
    public static final int RESULT_TOKEN_ERROR = -1;
    public static final int RESULT_TOKEN_CLEAR = 205;
    public static final int RESULT_TOKEN_DIFFERENT = 0;

    private T data;
    private int code;
    private String msg;
    private String time;
    private boolean status;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public boolean isSuccess() {
        return (code == RESULT_SUCCESS && data != null)||(code == 200 && data != null);
    }

    @Override
    public String toString() {
        return "code:" + code
                + " + message:" + msg
                + " + time:" + time
                + " + result:" + data.toString();
    }
}
